<!DOCTYPE html>
<html>
<head>
	<title>更改个人信息</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="fpnr.css">
	<link rel="shortcut icon" type="images/x-icon" href="images/favicon.ico">
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css">
	<script type="text/javascript" src="jquery.min.js"></script>
	<style type="text/css">
		.item span{
			cursor:pointer;
			transition: all .5s;
		}
		.item span:hover{
			color:#f43c43;
		}
	</style>
	<script>
		$(function(){
			$.ajax({
				url:"http://192.168.0.117:81/Accountnumber1",
				success:function(data){
					var data = JSON.parse(data);
					A = data[0].Accountnumber;
					$(".user").html(data[0].Accountnumber);
					$($("P")[4]).append($("<span></span>"));
				}
			})
			$.ajax({
				url:"http://192.168.0.117:81/users1",
				success:function(data){
					var data = JSON.parse(data)
					console.log(data)
					$(".IDnumber").html(data[0].IDnumber);
					$(".Name").html(data[0].Name);
					$(".Sex").html(data[0].Sex);
					$(".Telephone").html(data[0].Telephone)
					$(".Document_type").html(data[0].Document_type);
					$(".Password").html(data[0].Password);
					$(".Password1").html(data[0].Password1);
					$(".Email").html(data[0].Email)
				},
				error:function(){
					alert("获取信息失败！")
				}
			})
			var islock = true;
			$("td").click(function(){
				if(islock){
					if(!$(this).hasClass("change")){
						var _this = this;
						var tdCopy = $(this).html();
						$(this).html("");
						$(this).append($("<input type='' name=''>"));
						$("input").focus();
						islock = false;
						$("input").val(tdCopy);
						$("input").blur(function(){
							var txt = $("input").val();
							$(_this).html(txt);
							islock = true;
						})
					}
				}
			})
			$(".xiugai").click(function(){
				$.ajax({
					url:"http://192.168.0.117:81/changeData",
					data:{					
						IDnumber:$(".IDnumber").html(),
						Name:$(".Name").html(),
						Sex:$(".Sex").html(),
						Accountnumber:$(".user").html(),
						Document_type:$(".Document_type").html(),
						Telephone:$(".Telephone").html(),
						Password:$(".Password").html(),
						Password1:$(".Password1").html(),
						Email:$(".Email").html()
					},
					success:function(data){
						alert("修改成功！")
					},
					error:function(){
						alert("修改信息失败！")
					}
				})
			})
		})
	</script>
</head>
<body>
	<div class="content xg">
		<div class="top">
			<img src="images/u=576006878,3397872292&fm=26&gp=0.jpg">
			<span class="mc">精准扶贫贫困户档案管理&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;个人基本信息</span>
			<div class="topa">
				<a href="#" class="user">更改个人信息</a>
				<a href="../index.html">退出</a>
			</div>
		</div>
		<div class="text">
			<div class="texts">
				<h2>"扶贫账号"可用于登录精准扶贫贫困户档案管理系统服务平台</h2>
			</div>
			<div class="textx">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>身份证号</th>
							<th>姓名</th>
							<th>性别</th>
							<th>手机号</th>
							<th>证件类型</th>
							<th>密码</th>
							<th>确认密码</th>
							<th>个人邮箱</th>
							<th>修改</th>
						</tr>
					</thead>
					<tbody>
						<tr class="item">
							<td class="IDnumber"></td>
							<td class="Name"></td>
							<td class="Sex"></td>
							<td class="Telephone"></td>
							<td class="Document_type"></td>
							<td class="Password"></td>
							<td class="Password1"></td>
							<td class="Email"></td>
							<td class="change">
								<span class="xiugai">修改</span>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<div class="bottom"><strong>精准扶贫贫困户档案管理系统</strong><span class="zy">注意：请勿重复注册，仔细核对个人信息，非精准扶贫对象无法注册!</span></div>
	</div>
</body>
</html>	